package com.fhuc.utils;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.futurehope.R;


public class MyDialog extends Dialog
{
	ImageView dialog_title_image;// title ͼƬ
	Context context;
	TextView dialog_title, dialog_content;// ���⣬����
	Button btn_Ok, btn_cancel;// ȷ����ȡ�� ��ť

	public MyDialog(Context context)
	{
		super(context);
		this.context = context;
	}

	public MyDialog(Context context, int theme)
	{
		super(context, theme);
		this.context = context;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.dialog);
		findView();
	}

	public void findView()
	{
		dialog_title_image = (ImageView) findViewById(R.id.dialog_title_image);
		dialog_title = (TextView) findViewById(R.id.dialog_title);
		dialog_content = (TextView) findViewById(R.id.dialog_content);
		btn_Ok = (Button) findViewById(R.id.dialog_button_ok);
		btn_cancel = (Button) findViewById(R.id.dialog_button_cancel);
	}

	/**
	 * ���� title������
	 * 
	 * @param title
	 * @param content
	 */
	public void setMsg(String title, String content)
	{
		dialog_title.setText(title);
		dialog_content.setText(content);
	}

	/**
	 * ����title�ı���
	 * 
	 * @param ico
	 */
	public void setImage(int ico)
	{
		dialog_title_image.setImageResource(ico);
	}

	/**
	 * ��ߵİ�ť
	 * 
	 * @param str
	 * @param listener
	 */
	public void setOnPositiveButton(String str, View.OnClickListener listener)
	{
		btn_Ok.setText(str);
		btn_Ok.setOnClickListener(listener);
	}

	/**
	 * �ұߵİ�ť
	 * 
	 * @param str
	 * @param listener
	 */
	public void setOnNegativeButton(String str, View.OnClickListener listener)
	{
		btn_cancel.setText(str);
		btn_cancel.setOnClickListener(listener);
	}
    public  void setNegativegone(){
    	btn_cancel.setVisibility(View.GONE);
    }
}
